package com.dianjing.dianqun.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dianjing.dianqun.model.SystemLogs;
import com.dianjing.dianqun.service.LogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * @date : 2017年11月15日
 * 
 * @author: baoyongtao
 * 
 * @see :
 * 
 */
@Controller
@RequestMapping("/log")
public class LogController {

	@Autowired
	private LogService logService;

	@RequestMapping("list")
	public String list(HttpServletRequest request, ModelMap model) {
		return "log/list";
	}

	@ResponseBody
	@RequestMapping("list.json")
	public PageInfo<SystemLogs> getList(HttpServletRequest request, @RequestParam(defaultValue = "0") Integer pageNum,
			@RequestParam(defaultValue = "20") Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		PageInfo<SystemLogs> info = new PageInfo<>(logService.findAll());
		return info;
	}

}
